[mirrors]
http://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz

[vars]
filesize=3131891
sha512=9ec194f4783dae6de8c529cac31b5cfbfcfea212c5d47b1f87cd49df013e38f8580a9e7aa1384918df0921b4ba999d5e73eb6d6362cce2d7287e64308b673963
desc="The ncurses (new curses) library"

[deps]


[build]
#note, see quirky-customize, now using pkg ncurses instead of pkg curses.

CFLAGS="$optcflags" LDFLAGS="$optldflags" \
  ./configure --prefix="$butch_prefix" $xconfflags \
  --without-ada --without-manpages --without-tests \
  --enable-pc-files --with-shared --without-debug --without-libtool \
  --enable-symlinks --enable-widec \
  --enable-sigwinch --enable-hard-tabs --enable-colorfgbg \
  --with-normal

make -j$MAKE_THREADS || exit 1

make V=1 DESTDIR="$butch_install_dir" install

#LFS has hack for 8-bit curses: http://www.linuxfromscratch.org/lfs/view/development/chapter06/ncurses.html
dest="$butch_install_dir""$butch_prefix"
for lib in ncurses form panel menu ; do
    rm -f                    "$dest"/lib/lib${lib}.so
    echo "INPUT(-l${lib}w)" > "$dest"/lib/lib${lib}.so
    ln -sfv ${lib}w.pc        "$dest"/lib/pkgconfig/${lib}.pc
done
rm -f                     "$dest"/lib/libcursesw.so
echo "INPUT(-lncursesw)" > "$dest"/lib/libcursesw.so
ln -sfv libncurses.so      "$dest"/lib/libcurses.so

#a problem, many recipes have explicit "-lterminfo". I previously specified separate
#terminfo lib, by --with-termlib, however, it is named libtinfo.so, created a symlink.
#however have now removed separate terminfo, just put in a dummy link...
ln -s libcurses.so "$dest"/lib/libterminfo.so
#...good, cmake failed before, now builds.

#ncurses is so incredibly confusing. many apps expect headers in /include...
mv -f "$dest"/include/ncursesw/* "$dest"/include/
rmdir "$dest"/include/ncursesw
[ ! -h "$R"/include/ncursesw ] && [ -d "$R"/include/ncursesw ] && rm -rf "$R"/include/ncursesw
ln -snf . "$R"/include/ncursesw
